using System;
using System.Net;
using System.IO;
using System.Windows.Media.Imaging;
using System.Xml;

namespace Silvery.Loader
{
    /// <summary>
    /// 下载接口
    /// </summary>
    public interface ILoader : IDisposable
    {
        event DownloadProgressChangedEventHandler DownloadProgressChanged;
        event OpenReadCompletedEventHandler DownloadCompleted;
        void BeginDownLoad(Uri uri);
        void BeginDownLoad();
        /// <summary>
        /// 下一个下载
        /// </summary>
        ILoader Next { get; set; }
        Uri LoadUri { get; set; }
        IResStream Result { get; set; }
        LaoderState LaoderState { get; }
        void CancelDownload();
        /// <summary>
        /// 附加的信息
        /// </summary>
        object AppendInfo { get; set; }
    }
    /// <summary>
    /// 资源包下载接口
    /// zip是标准的资源包
    /// </summary>
    public interface IZIPLoader : ILoader
    {
        /// <summary>
        /// 从包里获得一张图片
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        BitmapImage GetImageFormZipPack(string filename);
        /// <summary>
        /// 从包里获得一段文本流
        /// </summary>
        /// <param name="Filename"></param>
        /// <returns></returns>
        Stream GetTextStreamFormZipPack(string Filename);
        /// <summary>
        /// 从包里获得一个XML
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        XmlReader GetXmlReaderFromZipPack(string filename);
    }
}
